package com.sky.mapper;

import com.sky.entity.Orders;
import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

/**
 * @author OZ.L.XO
 * #Description UserMapper
 * #Date: 2025/7/9 21:23
 */

@Mapper
public interface UserMapper {

    /**
     * 根据openid查询用户
     */
    @Select("select * from user where openid=#{openid}")
    User getByOpenid(String openid);

    /**
     * 插入数据
     */
    void insert(User user);

    /**
    * @Description
    * @Param [userId]
    * @Date 2025/7/31 20:25
    **/
    @Select("select * from user where id=#{userId}")
    User getByUserId(Long userId);

    /**
    * @Description 根据订单ID查询订单
    * @Param [orderId]
    * @Date 2025/7/31 21:36
    **/
    @Select("select * from orders where id=#{orderId}")
    Orders getByOrderId(Long orderId);

    /**
    * @Description 获取用户数量
    * @Param [map]
    * @Date 2025/7/31 21:36
    **/
    Integer userByTime(Map<String, Object> map);

}
